package com.itheima.shotplane.listener;


import android.view.View;
import android.view.ViewGroup;

import com.itheima.shotplane.entity.Car;


public class AddHeroListener extends AddEntityListener<Car>{

	public AddHeroListener(Car t) {
		super(t);
	}

	@Override
	protected void onLayoutFinish() {
		Car car = t;
		
		//将heao设置到底部中心
//		int parentWidth = ((ViewGroup) car.getParent()).getWidth();
//		int parentHeitht = ((ViewGroup) car.getParent()).getHeight();
//		float translationX = parentWidth/2 - car.getWidth()/2;
//        float setx = car.getSetx();
//        float sety = car.getSety();
//        car.setTranslationX(translationX);
//		car.setTranslationY(parentHeitht- car.getHeight());
//		car.setVisibility(View.VISIBLE);



        float setx = car.getSetx();
        float sety = car.getSety();
        car.setTranslationX(setx);
		car.setTranslationY(sety- car.getHeight());

		car.setVisibility(View.VISIBLE);
	}

}
